//
//  WCBaiduPushBindHelp.m
//  WC
//
//  Created by wsj2015 on 16/2/26.
//  Copyright © 2016年 ShanghaiCize Trade And Business Co., Ltd. All rights reserved.
//

#import "WCBaiduPushBindHelp.h"
#import "BPush.h"

@implementation WCBaiduPushBindHelp


+ (void)bindToService{
    
    //没有登录不绑定
    if (!BT_USERID) {
        return;
    }
    
    NSMutableDictionary *params =[NSMutableDictionary dictionary];
    //    userType : 1、护士 2、患者
    //    userId : nurseId or patientId
    //    appid,apikey,channelid : 百度云推送消息提供信息
    
    //如果是登陆情况 直接等
//    NSDictionary *dict =  [[WCDefaultManager shareMg]account];
//    if (dict) {
//        params[@"userType"] =@(2);

//        params[@"userId"]  = [[HELAppManager userInfo] userId];
//    }
    
    [BPush getUserId];
    
//    params[@"appid"] =[BPush getAppId];
//    params[@"apikey"] =@"W7ATVlLqhrGAdT3gokDnEPeZ" ;
//    params[@"channelid"] =[BPush getChannelId];
    
    [BPush bindChannelWithCompleteHandler:^(NSDictionary *result, NSError *error) {
        if (result[@"channel_id"]) {
            params[@"channelId"] = result[@"channel_id"];
        }
        if (result[@"app_id"]) {
            params[@"appId"] =result[@"app_id"];
            //跟 公司 服务器绑定
//            params[@"appId"] = @(8778013);
        
            
        }
        [[BTNetworkManager sharedMg] POST:kBPushBindToService parameters:params success:^(id responseObject) {
            
        } failure:^(NSString *err) {
            
        }];

        
    }];
   

}

@end
